<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="之前看过一些关于docker的视频，就是容器化技术，貌似跟python的虚拟环境很相似，可以把整个项目拉去下来并虚拟出一块空间放置依赖环境，起到环境隔离的作用，省去手动配置环境的步骤  看了一下午算法，有点懵，不想看下去了。 所以来学一学docker+jenkins+git持续部署这一套">
<meta property="og:type" content="article">
<meta property="og:title" content="docker 初识">
<meta property="og:url" content="http://example.com/2021/04/11/docker-%E5%88%9D%E8%AF%86/index.html">
<meta property="og:site_name" content="yyc&#39;s blog">
<meta property="og:description" content="之前看过一些关于docker的视频，就是容器化技术，貌似跟python的虚拟环境很相似，可以把整个项目拉去下来并虚拟出一块空间放置依赖环境，起到环境隔离的作用，省去手动配置环境的步骤  看了一下午算法，有点懵，不想看下去了。 所以来学一学docker+jenkins+git持续部署这一套">
<meta property="og:locale">
<meta property="og:image" content="https://gitee.com/goatyyc/giteep-page-imgs/raw/master/imgs/20210411225018.png">
<meta property="og:image" content="https://gitee.com/goatyyc/giteep-page-imgs/raw/master/imgs/20210411225111.png">
<meta property="og:image" content="http://example.com/2021/04/11/docker-%E5%88%9D%E8%AF%86/docker-%E5%88%9D%E8%AF%86.assets/image-20210413184304305.png">
<meta property="og:image" content="http://example.com/2021/04/11/docker-%E5%88%9D%E8%AF%86/docker-%E5%88%9D%E8%AF%86.assets/image-20210413184722411.png">
<meta property="article:published_time" content="2021-04-11T14:52:12.000Z">
<meta property="article:modified_time" content="2021-04-18T07:48:48.469Z">
<meta property="article:author" content="yyc">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/goatyyc/giteep-page-imgs/raw/master/imgs/20210411225018.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://example.com/2021/04/11/docker-初识/"/>





  <title>docker 初识 | yyc's blog</title>
  








<meta name="generator" content="Hexo 5.3.0"></head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta custom-logo">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">yyc's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术博客</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/04/11/docker-%E5%88%9D%E8%AF%86/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="yyc's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">docker 初识</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2021-04-11T22:52:12+08:00">
                2021-04-11
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E8%BF%90%E7%BB%B4/" itemprop="url" rel="index">
                    <span itemprop="name">运维</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <blockquote>
<p>之前看过一些关于docker的视频，就是容器化技术，貌似跟python的虚拟环境很相似，可以把整个项目拉去下来并虚拟出一块空间放置依赖环境，起到环境隔离的作用，省去手动配置环境的步骤</p>
</blockquote>
<p>看了一下午算法，有点懵，不想看下去了。</p>
<p>所以来学一学docker+jenkins+git持续部署这一套</p>
<a id="more"></a>



<p>官方文档：<a target="_blank" rel="noopener" href="https://docs.docker.com/get-started/overview/">https://docs.docker.com/get-started/overview/</a></p>
<hr>
<p><strong>概览：</strong></p>
<blockquote>
<p>Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.</p>
</blockquote>
<p><strong>结构体系：</strong></p>
<p>Docker architecture</p>
<p><img src="https://gitee.com/goatyyc/giteep-page-imgs/raw/master/imgs/20210411225018.png"></p>
<p>守护进程：Docker daemon</p>
<p>守护进程可以理解为进程守护（进程的守护），是用于监控指定的进程，当发现目标进程工作异常时，可以对该目标进程进行控制。如关闭该进程，并重新启动该进程。</p>
<p>参考：<a target="_blank" rel="noopener" href="https://blog.csdn.net/summer_style/article/details/108776795">https://blog.csdn.net/summer_style/article/details/108776795</a></p>
<hr>
<h2 id="安装Docker"><a href="#安装Docker" class="headerlink" title="安装Docker"></a>安装Docker</h2><p>安装方式有很多：</p>
<p>这里按官方文档：使用仓库安装</p>
<h3 id="Install-using-the-repository"><a href="#Install-using-the-repository" class="headerlink" title="Install using the repository"></a>Install using the repository</h3><p>1、SET UP THE REPOSITORY</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo yum install -y yum-utils</span><br><span class="line">sudo yum-config-manager \</span><br><span class="line">   --add-repo \</span><br><span class="line">   https://download.docker.com/linux/centos/docker-ce.repo</span><br></pre></td></tr></table></figure>


<p>2、安装docker-ce-client</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yum install docker-ce docker-ce-cli containerd.io</span><br></pre></td></tr></table></figure>


<p>3、开启docker</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl start docker</span><br></pre></td></tr></table></figure>


<p>4、试运行</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run hello-world</span><br></pre></td></tr></table></figure>
<p>该命令会拉取hello-world，然后展示</p>
<blockquote>
<p>This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.</p>
</blockquote>
<p><img src="https://gitee.com/goatyyc/giteep-page-imgs/raw/master/imgs/20210411225111.png"></p>
<p>其他安装方式：</p>
<h3 id="Install-from-a-package"><a href="#Install-from-a-package" class="headerlink" title="Install from a package"></a>Install from a package</h3><h3 id="Install-using-the-convenience-script"><a href="#Install-using-the-convenience-script" class="headerlink" title="Install using the convenience script"></a>Install using the convenience script</h3><h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><p><strong>1、Manage Docker as a non-root user</strong></p>
<p>docker的守护进程绑定到一个Unix socket，默认情况下只有超级用户root拥有这个socket的权限</p>
<p>可以创建用户组docker，使改组拥有docker的管理权限</p>
<p><strong>2、Use a different storage engine</strong></p>
<p><strong>3、Configure default logging driver</strong></p>
<p><strong>4、Configure where the Docker daemon listens for connections</strong></p>
<p>…</p>
<h1 id="Get-started"><a href="#Get-started" class="headerlink" title="Get started"></a>Get started</h1><h2 id="part-1"><a href="#part-1" class="headerlink" title="part 1"></a>part 1</h2><h3 id="container"><a href="#container" class="headerlink" title="container"></a>container</h3><p>Simply put, a container is simply another process on your machine that has been isolated from all other processes on the host machine. </p>
<p>就是主机上的一个与其他进程相隔离的进程</p>
<h3 id="container-image"><a href="#container-image" class="headerlink" title="container image"></a>container image</h3><p>When running a container, it uses an isolated filesystem. This custom filesystem is provided by a <strong>container image</strong>. </p>
<p>container image包含应用程序的所有依赖，配置，脚本等</p>
<h3 id="docker部署todolist"><a href="#docker部署todolist" class="headerlink" title="docker部署todolist"></a>docker部署todolist</h3><p>步骤：</p>
<h4 id="1、github下载安装包"><a href="#1、github下载安装包" class="headerlink" title="1、github下载安装包"></a>1、github下载安装包</h4><ul>
<li>下载：<a target="_blank" rel="noopener" href="https://github.com/docker/getting-started">https://github.com/docker/getting-started</a> 用编辑器打开app文件夹</li>
<li>在package.json的同级目录下创建Dockerfile文件</li>
</ul>
<p>文件内容如下：</p>
<figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">FROM</span> node:<span class="number">12</span>-alpine</span><br><span class="line"><span class="keyword">RUN</span><span class="bash"> apk add --no-cache python g++ make</span></span><br><span class="line"><span class="keyword">WORKDIR</span><span class="bash"> /app</span></span><br><span class="line"><span class="keyword">COPY</span><span class="bash"> . .</span></span><br><span class="line"><span class="keyword">RUN</span><span class="bash"> yarn install --production</span></span><br><span class="line"><span class="keyword">CMD</span><span class="bash"> [<span class="string">&quot;node&quot;</span>, <span class="string">&quot;src/index.js&quot;</span>]</span></span><br></pre></td></tr></table></figure>


<h4 id="2、上传app文件夹至服务器"><a href="#2、上传app文件夹至服务器" class="headerlink" title="2、上传app文件夹至服务器"></a>2、上传app文件夹至服务器</h4><p>使用winscp或者xftp等上传app文件夹到服务器上</p>
<p>比如用户的home目录下</p>
<h4 id="3、执行docker-build"><a href="#3、执行docker-build" class="headerlink" title="3、执行docker build"></a>3、执行docker build</h4><p>cd 进入app目录，运行命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker build -t getting-start</span><br></pre></td></tr></table></figure>
<p>该命令使用Dockerfile（刚创建的）建立一个新的container image。</p>
<p>创建的时候会出现很多下载layers的提示，这是因为Dockerfile指示的需要node:12-alpine 这些image</p>
<p>下载完成后会把应用程序和相关依赖 构建成镜像</p>
<blockquote>
<p><code>docker build</code>命令是调用 Docker 从 Dockerfile 文件构建 docker 镜像，要使用<code>docker build</code>命令，必须告诉它从哪个 Dockerfile 文件生成镜像。</p>
</blockquote>
<p>运行命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker iamges</span><br></pre></td></tr></table></figure>
<p>查看本机所有docker镜像</p>
<h4 id="4、docker-run"><a href="#4、docker-run" class="headerlink" title="4、docker run"></a>4、docker run</h4><p>开启上传的app：todolist</p>
<p>（1）运行命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -dp 3000:3000 getting-started .	// 当前目录下</span><br></pre></td></tr></table></figure>
<p>参数：</p>
<p><strong>-d:</strong> 后台运行容器，并返回容器ID；</p>
<p><strong>-p:</strong> 指定端口映射，格式为：<strong>主机(宿主)端口:容器端口</strong>   </p>
<p>（2）访问：ip:3000</p>
<h3 id="容器与镜像"><a href="#容器与镜像" class="headerlink" title="容器与镜像"></a>容器与镜像</h3><p>镜像image和容器container的关系：</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_40722827/article/details/102827125">https://blog.csdn.net/qq_40722827/article/details/102827125</a></p>
<h2 id="part-2"><a href="#part-2" class="headerlink" title="part 2"></a>part 2</h2><h3 id="update-the-application"><a href="#update-the-application" class="headerlink" title="update the application"></a>update the application</h3><h4 id="1、修改源文件：src-static-js-app-js"><a href="#1、修改源文件：src-static-js-app-js" class="headerlink" title="1、修改源文件：src/static/js/app.js"></a>1、修改源文件：src/static/js/app.js</h4><h4 id="2、更新镜像"><a href="#2、更新镜像" class="headerlink" title="2、更新镜像"></a>2、更新镜像</h4><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker build -t getting-started .</span><br></pre></td></tr></table></figure>
<h4 id="3、重跑服务"><a href="#3、重跑服务" class="headerlink" title="3、重跑服务"></a>3、重跑服务</h4><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -dp 3000:3000 getting-started</span><br></pre></td></tr></table></figure>


<p>如果用的是久端口，会出现异常：3000端口已分配</p>
<p>因此需要移除旧容器</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">docker ps</span><br><span class="line">docker stop container-id</span><br><span class="line">docker rm container-id</span><br></pre></td></tr></table></figure>


<h2 id="part3"><a href="#part3" class="headerlink" title="part3"></a>part3</h2><h3 id="share-the-application"><a href="#share-the-application" class="headerlink" title="share the application"></a>share the application</h3><blockquote>
<p>Docker ID</p>
<p>Docker Hub是最大的镜像库和社区，可以创建一个Docker ID</p>
</blockquote>
<h3 id="创建一个仓库"><a href="#创建一个仓库" class="headerlink" title="创建一个仓库"></a>创建一个仓库</h3><p>把镜像上传到Docker Hub先要在Docker Hub上创建一个仓库</p>
<ol>
<li><p><a target="_blank" rel="noopener" href="https://www.docker.com/pricing?utm_source=docker&utm_medium=webreferral&utm_campaign=docs_driven_upgrade">Sign up</a> 注册账号</p>
</li>
<li><p>Sign in to <a target="_blank" rel="noopener" href="https://hub.docker.com/">Docker Hub</a>.登录Docker Hub</p>
</li>
<li><p>Click the <strong>Create Repository</strong> button. 创建仓库</p>
</li>
<li><p>For the repo name, use <code>getting-started</code>. Make sure the Visibility is <code>Public</code>.</p>
<p>至于仓库名称，使用之前创建的getting-started，并确保是公开的（Public）</p>
</li>
<li><p>Click the <strong>Create</strong> button!</p>
</li>
</ol>
<h3 id="上传镜像到仓库"><a href="#上传镜像到仓库" class="headerlink" title="上传镜像到仓库"></a>上传镜像到仓库</h3><p>​    </p>
<p>1、运行命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker push docker/getting-started</span><br></pre></td></tr></table></figure>
<p>显然第一次运行会失败，需要tag（标记）已经存在的镜像，给它另外一个名字</p>
<p>2、登录docker hub ：运行命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker login -u YOUR-USER-NAME</span><br></pre></td></tr></table></figure>
<p><img src="docker-%E5%88%9D%E8%AF%86.assets/image-20210413184304305.png" alt="image-20210413184304305"></p>
<p>3、dacker tag命令给getting-started镜像起一个新名字，</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker tag getting-started YOUR-USER-NAME/getting-started</span><br></pre></td></tr></table></figure>


<p>4、推送镜像到仓库</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker push YOUR-USER-NAME/getting-started</span><br></pre></td></tr></table></figure>
<p><img src="docker-%E5%88%9D%E8%AF%86.assets/image-20210413184722411.png" alt="image-20210413184722411"></p>
<h3 id="使用一个新的实例运行镜像"><a href="#使用一个新的实例运行镜像" class="headerlink" title="使用一个新的实例运行镜像"></a>使用一个新的实例运行镜像</h3><p>1、打开浏览器：<a target="_blank" rel="noopener" href="https://labs.play-with-docker.com/">Play with Docker</a>.</p>
<p>2、登录并选择下拉菜单的docker</p>
<p>3、连接Docker hub账户</p>
<p>4、左侧边栏点击add new instance选项</p>
<p>5、运行命令，启动刚刚推送的应用</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -dp 3000:3000 YOUR-USER-NAME/getting-started</span><br></pre></td></tr></table></figure>


<p>6、点击第一行的3000，开启docker上的应用</p>
<h3 id="回顾"><a href="#回顾" class="headerlink" title="回顾"></a>回顾</h3><blockquote>
<p>In this section, we learned how to share our images by pushing them to a registry. We then went to a brand new instance and were able to run the freshly pushed image. This is quite common in CI pipelines, where the pipeline will create the image and push it to a registry and then the production environment can use the latest version of the image.</p>
<p>Now that we have that figured out, let’s circle back around to what we noticed at the end of the last section. As a reminder, we noticed that when we restarted the app, we lost all of our todo list items. That’s obviously not a great user experience, so let’s learn how we can persist the data across restarts!</p>
</blockquote>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2021/04/08/blog-%E9%83%A8%E7%BD%B2%E4%B8%8A%E7%BA%BF/" rel="next" title="blog 部署上线">
                <i class="fa fa-chevron-left"></i> blog 部署上线
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2021/04/13/springboot%E4%B8%AD%E7%BC%93%E5%AD%98%E7%9A%84%E4%BD%BF%E7%94%A8/" rel="prev" title="springboot中缓存的使用">
                springboot中缓存的使用 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.png"
                alt="" />
            
              <p class="site-author-name" itemprop="name"></p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
                <a href="/archives">
                  <span class="site-state-item-count">23</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">9</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%89%E8%A3%85Docker"><span class="nav-text">安装Docker</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Install-using-the-repository"><span class="nav-text">Install using the repository</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Install-from-a-package"><span class="nav-text">Install from a package</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Install-using-the-convenience-script"><span class="nav-text">Install using the convenience script</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%85%8D%E7%BD%AE"><span class="nav-text">配置</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Get-started"><span class="nav-text">Get started</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#part-1"><span class="nav-text">part 1</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#container"><span class="nav-text">container</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#container-image"><span class="nav-text">container image</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#docker%E9%83%A8%E7%BD%B2todolist"><span class="nav-text">docker部署todolist</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1%E3%80%81github%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85%E5%8C%85"><span class="nav-text">1、github下载安装包</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2%E3%80%81%E4%B8%8A%E4%BC%A0app%E6%96%87%E4%BB%B6%E5%A4%B9%E8%87%B3%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="nav-text">2、上传app文件夹至服务器</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3%E3%80%81%E6%89%A7%E8%A1%8Cdocker-build"><span class="nav-text">3、执行docker build</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#4%E3%80%81docker-run"><span class="nav-text">4、docker run</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%B9%E5%99%A8%E4%B8%8E%E9%95%9C%E5%83%8F"><span class="nav-text">容器与镜像</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#part-2"><span class="nav-text">part 2</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#update-the-application"><span class="nav-text">update the application</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1%E3%80%81%E4%BF%AE%E6%94%B9%E6%BA%90%E6%96%87%E4%BB%B6%EF%BC%9Asrc-static-js-app-js"><span class="nav-text">1、修改源文件：src&#x2F;static&#x2F;js&#x2F;app.js</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2%E3%80%81%E6%9B%B4%E6%96%B0%E9%95%9C%E5%83%8F"><span class="nav-text">2、更新镜像</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3%E3%80%81%E9%87%8D%E8%B7%91%E6%9C%8D%E5%8A%A1"><span class="nav-text">3、重跑服务</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#part3"><span class="nav-text">part3</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#share-the-application"><span class="nav-text">share the application</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E4%BB%93%E5%BA%93"><span class="nav-text">创建一个仓库</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%8A%E4%BC%A0%E9%95%9C%E5%83%8F%E5%88%B0%E4%BB%93%E5%BA%93"><span class="nav-text">上传镜像到仓库</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BD%BF%E7%94%A8%E4%B8%80%E4%B8%AA%E6%96%B0%E7%9A%84%E5%AE%9E%E4%BE%8B%E8%BF%90%E8%A1%8C%E9%95%9C%E5%83%8F"><span class="nav-text">使用一个新的实例运行镜像</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%9B%9E%E9%A1%BE"><span class="nav-text">回顾</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">yyc</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
